<%@ page import="cn.wsxiot.util.DBUtil" %>
<%@ page import="java.sql.*" %><%--
  Created by IntelliJ IDEA.
  User: wsx
  Date: 18-1-1
  Time: 下午4:47
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    String uemail = (String) request.getSession().getAttribute("uemail");
    if(uemail == null){
        response.sendRedirect(request.getContextPath() + "/login.jsp");
    }
%>
<html>
<head>
    <title>index</title>
</head>
<body>
<div>uemail: <%=uemail%> 已登录 </div>
<%
    Connection conn = null;
    Statement st = null;
    ResultSet rss = null;
    String sql = "select uemail from user";
    conn = DBUtil.getConnection();
    if(conn == null)
        return;
    System.out.println("数据库连接成功");
    st = conn.createStatement();
    rss = st.executeQuery(sql);
    out.print("<table><tr><td>uemail</td></tr>");
    while(rss.next()){
        out.print("<tr><td>" + rss.getString(1) + "</td></tr>");
    }
    out.print("</table>");
%>
</body>
</html>
